<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>项目人员管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.w280{ width: 280px; }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">项目人员管理</div>
		<div class="right">
			<div class="input-group left w200">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按项目编号/名称搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
            <if condition="is_permission('PU',NULL,1)">
                <a href="__APP__/Hr/project_user_position" class="btn left ml5" target="_blank">项目职务</a>
            </if>
		</div>
	</div>
	<div id="content">
		<div class="filter clearfix">
			<div class="filter-item w280 left" style="border: none">
				<div class="filter-title">人员情况：</div>
				<ul class="filter-order">
					<li <if condition="$status eq -10">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/-10/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">全部</a>
					</li>
					<li <if condition="$status eq 1">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/1/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">工作中</a>
					</li>
				<!--
					<li <if condition="$status eq -1">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/-1/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">拟分配</a>
					</li>
				-->
					<li <if condition="$status eq -2	">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/-2/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">待分配</a>
					</li>
				</ul>
			</div>
			<div class="filter-item w280 left" style="border: none">
				<div class="filter-title">折叠方式：</div>
				<ul class="filter-order">
					<li <if condition="$fold eq -1">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/-1/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">展开</a>
					</li>
					<li <if condition="$fold eq 1">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/1/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">折叠</a>
					</li>
				</ul>
			</div>
			<div class="filter-item w280 left" style="border: none">
				<div class="filter-title">项目状态：</div>
				<ul class="filter-order">
					<li <if condition="$p_status eq -10">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/-10/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">全部</a>
					</li>
					<li <if condition="$p_status eq 1">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/1/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">进行中</a>
					</li>
					<li <if condition="$p_status eq 2">class="current"</if>>
						<a href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/2/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}">已暂停/结束</a>
					</li>
				</ul>
			</div>
			<!--
			<div class="filter-item w280 left" style="border: none">
				<div class="filter-title">日期筛选：</div>
				<div>
					<input name="t_day" value="{$t_day}" type="text" class="form-control Wdate required-text w100" onclick="WdatePicker()" readonly autocomplete="off">
					<button class="btn t_day_search" type="button">搜索</button>
				</div>
			</div>
			-->
		</div>
		<div class="table-scrollx">
			<table class="table table-bordered table-hover table-hover-contact">
				<tr class="table-header fixed-table-header">
					<td width="10%">姓名</td>
					<td width="16%">手机号</td>
					<td width="16%">
						<select name="position" class="form-control" autocomplete="off">
							<option value="-10">职位</option>
							<foreach name="result6" item="vo">
								<option value="{$vo}" <if condition="$vo eq $position">selected</if>>{$vo}</option>
							</foreach>
						</select>
					</td>
					<td width="16%">
						<select name="post" class="form-control" autocomplete="off">
							<option value="-10">项目职务</option>
							<foreach name="result4" item="vo">
								<option value="{$vo['id']}" <if condition="$vo['id'] eq $post">selected</if>>{$vo['second_name']}</option>
							</foreach>
						</select>
					</td>
					<td width="16%">
						<select name="rank" class="form-control w100" autocomplete="off">
							<option value="-10">职级</option>
							<foreach name="result5" item="vo">
								<option value="{$vo['second_name']}" <if condition="$vo['second_name'] eq $rank">selected</if>>{$vo['second_name']}</option>
							</foreach>
						</select>
					</td>
					<td width="16%">
						<select name="nature" class="form-control" style="width:85px;">
							<option value="-10"<if condition="$nature eq -10"> selected</if>>性质</option>
							<option value="常驻"<if condition="$nature eq '常驻'"> selected</if>>常驻</option>
							<option value="临时"<if condition="$nature eq '临时'"> selected</if>>临时</option>
							<option value="无"<if condition="$nature eq '无'"> selected</if>>无</option>
						</select>
					</td>
					<td width="15%">派驻时间</td>
					<if condition="is_permission('PU',NULL,1)">
					<td width="5%">管理</td>
					</if>
				</tr>
				<if condition="$result eq NULL">
					<tr>
						<td <if condition="is_permission('PU',NULL,1)">colspan="8"<else />colspan="7"</if> class="text-center">暂无相关内容</td>
					</tr>
				</if>
				<foreach name="result" item="vo">
					<volist name="vo['detail']" id="vv" key="keys">
						<if condition="$keys eq 1">
							<tr class="sum_tr">
								<td colspan="8" class="title_tr"><if condition="$vo['pid'] eq -10">拟分配({$vo['sum']}人)<elseif condition="$vo['pid'] eq -11" />待分配({$vo['sum']}人)<else /><a href="__APP__/Hr/project_user_detail_p/pid/{$vo['pid']}" target="_blank">[{$vo['project_num']}]{$vo['project_name']}({$vo['sum']}人)</a></if><a class="slide-down ml10" href="javascript:;" data-toggle="tooltip" data-placement="right" title=""><i class="glyphicon glyphicon-chevron-up"></i></a></td>
								<!--<td colspan="7" class="title_tr"><if condition="$vo['project_num'] neq NULL"><a href="__APP__/Hr/project_user_detail_p/pid/{$vo['pid']}">[{$vo['project_num']}]{$vo['project_name']}({$vo['sum']}人)</a><a class="slide-down ml10" href="javascript:;" data-toggle="tooltip" data-placement="right" title=""><i class="glyphicon glyphicon-chevron-up"></i></a><else />待分配({$vo['sum']}人)<a class="slide-down ml10" href="javascript:;" data-toggle="tooltip" data-placement="right" title=""><i class="glyphicon glyphicon-chevron-up"></i></a></if></td>-->
							</tr>
						</if>
						<tr>
							<td><a href="__APP__/Hr/project_user_detail_u/uid/{$vv['uid']}" target="_blank">{$vv['username']}</a></td>
							<td>{$vv['mobilephone']}</td>
							<td>{$vv['position']}</td>
							<td><if condition="$vv['post'] neq NULL">{$vv['post']}<else/>{$vv['position']}</if></td>
							<td>{$vv['rank']}</td>
							<td>{$vv['nature']}</td>
							<td>{$vv['come_date']}</td>
							<if condition="is_permission('PU',NULL,1)">
							<td><a href="__APP__/Hr/project_user_edit/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}/uid/{$vv['uid']}" class="mr5" data-toggle="tooltip" data-placement="left" title="编辑"><i class="glyphicon glyphicon-edit"></i></a></td>
							</if>
						</tr>
					</volist>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--对话框-->
<div class="modal fade" id="myModal_startup">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>启用提示框</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
			<div class="modal-footer">
				<button type="button" class="btn ok_startup">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<div class="toolbar-annotation">
	<div class="annotation-title">功能注解</div>
	<ul class="annotation-item">
		<li>【系统-用户列表】中生成的项目人员将默认显示在【待分配】栏；</li>
		<li>【项目人员管理-人员信息】中，编辑手机号、职位、职级内容将同步更新【系统-用户列表】；</li>
		<li>【项目人员管理-工作情况】中，新增项目工作情况的【派驻日期】将自动同步到上一工作记录的【派出日期】，若两者之前存在时间间隔的，需对应添加相应时间间隔的【待分配】日期记录；</li>
		<li>【项目人员管理】为运营项目的项目组人员唯一调整方式，相应项目的启动表中无权进行项目人员管理。</li>
	</ul>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function() {
	//搜索
	$(".found_btn").keywordSearch("__APP__/Hr/project_user/keyword/$keyword/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}");
	//日期筛选
	$(".t_day_search").click(function(){
		var val = $("[name='t_day']").val();
		document.location.href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/"+val+"/position/{$position}/rank/{$rank}/post/{$post}/nature/{$nature}";
	});
	//表头选择
	$(document).on("change","[name='position']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/"+val+"/rank/{$rank}/post/{$post}/nature/{$nature}";
	});
	$(document).on("change","[name='rank']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/"+val+"/post/{$post}/nature/{$nature}";
	});
	$(document).on("change","[name='post']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/"+val+"/nature/{$nature}";
	});
	$(document).on("change","[name='nature']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Hr/project_user/keyword/{$keyword}/status/{$status}/fold/{$fold}/p_status/{$p_status}/t_day/{$t_day}/position/{$position}/rank/{$rank}/post/{$post}/nature/"+val;
	});
	
	//禁用
	$(".cancle_user").ajaxModal({"title_text":"确认提示框","body_text":"您确定要禁用该用户吗？","url":"__APP__/Hr/project_user_ajax_status","data":{"id":"uid","action":"action"}});

	//启用
	$(".startup_user").click(function(){
		var uid = $(this).attr("uid"),
			leave = $(this).attr("leave"),
			$body = $("#myModal_startup .modal-body");
		
		$("#myModal_startup").modal({
			"show":true,
			"backdrop":"static"
		}).find(".ok_startup").attr({"uid":uid,"leave":leave});
		
		if(leave==1){
			$.ajax({
				type:"POST",
				dataType:'json',
				async:false,
				data:{"id":uid,"action":"department"},
				url:"__APP__/Hr/project_user_ajax_status",
				success:function(data){
					var $select = "姓名："+data.username+"<br>";
					$select += "<div class='mt10'>部门：";
					$select += "<select class='form-control w200 modal-department'>";
					$select += "<option value='-10' selected>请选择</option>";
					for(var i=0;i<data.department.length;i++){
						$select += "<option value="+data.department[i].id+">"+data.department[i].department+"</option>";
					}
					$select += "</select>";
					$select += "<span class='error-item'>必填项</span>";
					$select += "</div>";
					
					$body.html($select);
				}
			});
		}else{
			$body.html("您确定要启用该用户吗?");
		}
	});

	$(".ok_startup").on("click",function(){
		var uid = $(this).attr("uid"),
			tag = true;
		
		$("select.modal-department").each(function(){
			if($(this).val()==-10){
				$(this).next(".error-item").show();
				tag = false;
			}
		});
		
		if(tag){
			var $department_id = $("select.modal-department").val();
			
			$("#myModal_startup").hide();
			$.ajax({
				type:"POST",
				dataType:'json',
				async:false,
				data:{"id":uid,"action":"on","department_id":$department_id},
				url:"__APP__/Hr/project_user_ajax_status",
				success:function(data){
					success_pop(data.status,data.msg);
				}
			});
		}
	});
	//展开收起考评详情
	$(".slide-down").click(function(){
		var parents = $(this).parents(".sum_tr"),
			icon = $(this).find("i");
		if(icon.hasClass("glyphicon-chevron-down")){
			parents.nextUntil(".sum_tr","tr").show();
			icon.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
		}else{
			parents.nextUntil(".sum_tr","tr").hide();
			icon.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
		}
	});

	if("{$fold}"!=-1){
		$(".slide-down").trigger("click");
	}

	//取消错误提示
	$("#myModal_startup").on("change","select.modal-department",function(){
		$(this).next(".error-item").hide();
	});
});
</script>
</body>
</html>